package cn.com.bluemoon.daps.api.sys;

import cn.com.bluemoon.daps.api.sys.factory.RemoteSystemTagsServiceFallbackFactory;
import cn.com.bluemoon.daps.common.constant.ServiceNameConstants.DapsApiSystem;
import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.system.entity.DapSystemTag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Optional;

@FeignClient(value = DapsApiSystem.SERVICE, fallbackFactory = RemoteSystemTagsServiceFallbackFactory.class)
@RequestMapping(DapsApiSystem.BASE_URI + DapsApiSystem.API_SYS_TAG)
@ApiIgnore
public interface RemoteSystemTagsService {

    @GetMapping("/list")
    ResultBean<List<DapSystemTag>> getTags(@RequestParam("modelId") String modelId,
                                           @RequestParam("status") Integer status);

    /**
     * 获取所有标签
     *
     * @return 获取所有标签
     */
    @GetMapping("/")
    ResultBean<List<DapSystemTag>> list();

    /**
     * 根据标签名称获取标签
     *
     * @param name 根据标签名称获取标签
     * @return 根据标签名称获取标签
     */
    @GetMapping("/get")
    public ResultBean<Optional<DapSystemTag>> getByName(@RequestParam("name") String name);
}
